package com.gaogzhen.constant;

public class LoginConstant {
    /**
     * 后台管理人员
     */
    public static final String ADMIN_TYPE = "admin_type";

    /**
     * 会员
     */
    public static final String MEMBER_TYPE = "member_type";

    /**
     * 管理员角色
     */
    public static final String ADMIN_ROLE_CODE = "ROLE_ADMIN";

    /**
     * 授权类型：refresh_token
     */
    public static final String REFRESH_TOKEN = "refresh_token";

    /**
     * 根据用户名查询管理员信息
     */
    public static final String QUERY_AMDIN_SQL = "select id,  password, status from sys_user where username=?";

    /**
     * 根据用户名查询会员信息
     */
    public static final String QUERY_MEMBER_SQL = "select id,  password, status from user where mobile=? or email=?";

    /**
     * 根据用户ID查询管理员用户名
     */
    public static final String QUERY_ADMIN_WITH_ID = "select username from sys_user where id=?";

    /**
     * 根据用户ID查询会员用户名
     */
    public static final String QUERY_MEMBER_WITH_ID = "select username from user where id=?";

    /**
     * 根据用户ID查询角色
     */
    public static final String QUERY_ROLE_CODE_SQL = "select r.code from sys_role r left join sys_user_role u on r.id=u.role_id where u.user_id=?";

    /**
     * 查询所有权限
     */
    public static final String QUERY_ALL_PERMISSIONS = "select name from sys_privilege";

    /**
     * 根据用户ID查询权限
     */
    public static final String QUERY_PERMISSION_SQL = "select p.name from sys_privilege p left join sys_role_privilege rp on rp.privilege_id=p.id left join sys_user_role ur on ur.role_id=rp.role_id where ur.user_id=?";

}
